"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.WidgetSelectFormComponent = void 0;
var _vue = require("vue");
var _core = require("@vxe-ui/core");
var _form = _interopRequireDefault(require("../../form/src/form"));
var _formItem = _interopRequireDefault(require("../../form/src/form-item"));
var _input = _interopRequireDefault(require("../../input/src/input"));
var _switch = _interopRequireDefault(require("../../switch/src/switch"));
var _use = require("../../form-design/src/use");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const WidgetSelectFormComponent = exports.WidgetSelectFormComponent = (0, _vue.defineComponent)({
  props: {
    renderOpts: {
      type: Object,
      default: () => ({})
    },
    renderParams: {
      type: Object,
      default: () => ({})
    }
  },
  emits: [],
  setup(props) {
    const {
      renderDataSourceFormItem
    } = (0, _use.useWidgetPropDataSource)(props, {
      isSubOption: true
    });
    const {
      computeKebabCaseName
    } = (0, _use.useWidgetName)(props);
    return () => {
      const {
        renderParams
      } = props;
      const {
        widget
      } = renderParams;
      const kebabCaseName = computeKebabCaseName.value;
      return (0, _vue.h)(_form.default, {
        class: ['vxe-form-design--widget-render-form-wrapper', `widget-${kebabCaseName}`],
        vertical: true,
        span: 24,
        titleBold: true,
        titleOverflow: true,
        data: widget.options
      }, {
        default() {
          return [(0, _vue.h)(_formItem.default, {
            title: (0, _core.getI18n)('vxe.formDesign.widgetProp.name')
          }, {
            default() {
              return (0, _vue.h)(_input.default, {
                modelValue: widget.title,
                'onUpdate:modelValue'(val) {
                  widget.title = val;
                }
              });
            }
          }), (0, _vue.h)(_formItem.default, {
            title: (0, _core.getI18n)('vxe.formDesign.widgetProp.required')
          }, {
            default() {
              return (0, _vue.h)(_switch.default, {
                modelValue: widget.required,
                'onUpdate:modelValue'(val) {
                  widget.required = val;
                }
              });
            }
          }), renderDataSourceFormItem()];
        }
      });
    };
  }
});